﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogicLayer;

namespace logicunivesityinventorystore.Store
{
    public partial class ViewAdjustmentVoucher : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (gdAdjustment.Rows.Count == 0)
            {
                lbAdjustmentVoucher.Visible = false;
                ScriptManager.RegisterStartupScript(this, typeof(string), "Error", "alert('There is no voucher now!');window.location.href = 'HomePage_Department.aspx'", true);
            }

        }

        protected void gdAdjustment_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string voucherID = (e.Row.FindControl("lbtnVoucherID") as LinkButton).Text;
                (e.Row.FindControl("lbtnVoucherID") as LinkButton).Attributes.Add("onClick", "ShowEditModal('VoucherDetails.aspx?VoucherID=" + voucherID + "');");

            }
        }
    }
}